<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="java.util.*" %>

<%
	String category = request.getParameter("category");
	if (category==null) category="";
	String initial = request.getParameter("initial");
	if (initial==null) initial="";
	String platform = request.getParameter("platform");
	if (platform==null) platform="";
	String p = request.getParameter("p");
	if (p==null) p="";
 %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>动作冒险 - 3DS DS 游戏 资讯 攻略 发售 下载</title>
<meta name="description" content="" />
<meta name="keywords" content="动作冒险 DSDOWN 3DS DS DSI GB GBA WII WIIU Nintendo 任天堂 游戏 攻略 发售 资讯 " />
<link href="style/list.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style></head>

<script src="script/functions.js" type="text/javascript"></script>
<script src="script/jQuery.js" type="text/javascript"></script>
<script type="text/javascript">

	var header_count = 2;
	var nullsearch = "搜索游戏,资讯,攻略";
	
	$(document).ready(
		function()
		{
			$("#searchtext").keydown(
			function(e)
			{
				if(e.which==13) doSearch();
			}
			)
		}
	)
	
	function showTip(target,tipname)
	{
		var left = $(target).offset().left;
		var top = $(target).offset().top;
		var height = $(target).height();
		
		$(tipname).css("left",left + "px");
		$(tipname).css("top",top + height + "px");
		$(tipname).css("display","block");
	}
	
	function hideTip(tipname)
	{
		$(tipname).css("display","none");
	}
	
	function showMask(target)
	{
		var left = $(target).offset().left;
		var top = $(target).offset().top;
		var width = $(target).width();
		var height = $(target).height();
		
		$("#mask").css("left",left+"px");
		$("#mask").css("top",top+"px");
		$("#mask").css("width",width+"px");
		$("#mask").css("height",height+"px");
		$("#mask").css("display","block");
	}
	
	function hideMask()
	{
		$("#mask").css("display","none");
	}
	
	function doSearch()
	{
		var value = $("#searchtext").val();
		if (value=='' || value == nullsearch)
		{
			alert('请输入关键字');
			$("#searchtext").focus();
		}
		else if (value.length < 3)
		{
			alert('关键字太短，无法搜索');
			$("#searchtext").focus();
			$("#searchtext").select();
		}
		else
		{
			var uri = 'search.do?k='+ encodeURI(encodeURI(value));
			window.open(uri);
		}
	}

</script>



<body>

<!-- 外层 -->
<div class="detail">

<!-- 主页面 -->
<div class="main">

	<%@ include file="header.jsp" %>

	<div class="header_shadow"></div>
	
	<!-- 外框阴影 -->
	<div class="center_shadow">
		<!-- 内容 -->
		<div class="content">
      	<!-- 左侧栏 -->
      	<div class="leftdiv">
		
			<div class="filter">
				<div>
					<span>分类：</span>
					<% 	List<java.util.Map> gameTypeList = (List<java.util.Map>)request.getAttribute("gameTypeList");
						for (int i=0;i<gameTypeList.size();i++){
						if (gameTypeList.get(i).get("game_type_id").toString().equals(category)){ %>
					<b><%= gameTypeList.get(i).get("game_type_name") %></b>
					<% }else{
						String url = String.format(
						"game_list.do?category=%s&initial=%s&platform=%s&p=%s",
						gameTypeList.get(i).get("game_type_id"),
						initial,
						platform,
						1);
					%>
					<a href="<%= url %>"><%= gameTypeList.get(i).get("game_type_name") %></a>					
					<% }} %>
				</div>
				<div>
					<span>首字母：</span>
					<% 	List<java.util.Map> gameInitialList = (List<java.util.Map>)request.getAttribute("gameInitialList");
						for (int i=0;i<gameInitialList.size();i++){
						if (gameInitialList.get(i).get("game_initial_id").toString().equals(initial)){ %>
					<b><%= gameInitialList.get(i).get("game_initial_name") %></b>
					<% }else{
						String url = String.format(
						"game_list.do?category=%s&initial=%s&platform=%s&p=%s",
						category,
						gameInitialList.get(i).get("game_initial_id"),
						platform,
						1);
					%>
					<a href="<%= url %>"><%= gameInitialList.get(i).get("game_initial_name") %></a>					
					<% }} %>
				</div>
				<div>
					<span>平台：</span>
					<% 	List<java.util.Map> gamePlatformList = (List<java.util.Map>)request.getAttribute("gamePlatformList");
						for (int i=0;i<gamePlatformList.size();i++){
						if (gamePlatformList.get(i).get("game_platform_id").toString().equals(platform)){ %>
					<b><%= gamePlatformList.get(i).get("game_platform_name") %></b>
					<% }else{
						String url = String.format(
						"game_list.do?category=%s&initial=%s&platform=%s&p=%s",
						category,
						initial,
						gamePlatformList.get(i).get("game_platform_id"),
						1);
					%>
					<a href="<%= url %>"><%= gamePlatformList.get(i).get("game_platform_name") %></a>					
					<% }} %>
				</div>				
			</div>
			
			<% List<java.util.Map> gameList = (List<java.util.Map>)request.getAttribute("gameList"); %>
			<% for (int i=0;i<gameList.size();i++){ %>
			
			<a class="gameitem" href="/gamedetail.do?id=<%= gameList.get(i).get("game_id") %>" target="_blank">
				<div class="gameitem_left">
					<img src="<%= gameList.get(i).get("game_img_small") %>"/>
				</div>
				<div class="gameitem_right">
					<big><%= gameList.get(i).get("simplified_chinese_name") %></big>
					<small>发行商：<%= gameList.get(i).get("game_publish_company") %></small>
					<small>类型：<%= gameList.get(i).get("game_type_name") %></small>
					<p><%= gameList.get(i).get("game_introduction") %></p>
				</div>
			</a>
			<% } %>
							
			<!-- 页码 -->
			<%
				Integer pageCount = (Integer)request.getAttribute("pageCount");
				if (pageCount>1)
				{
					Integer ppage = 1;
					if (p!="") ppage = Integer.valueOf(p);
					Integer pageStart = ppage - 3;
					if (pageStart<1) pageStart=1;
					Integer pageEnd = ppage + 3;
					if (pageEnd>pageCount) pageEnd=pageCount;
				
					String purl = String.format(
						"game_list.do?category=%s&initial=%s&platform=%s&p=",
						category,
						initial,
						platform
						);
			%>

			<div class="page">
				<% if (pageStart>1){ %><a href="<%= purl+"1" %>">第一页</a> ...<%} %>
				<%
					for (Integer i=pageStart;i<=pageEnd;i++){
						if (i.equals(ppage)){
				%>
							<span><%= i.toString() %></span>				
				<%
						}else{
				%>
							<a href="<%= purl+i.toString() %>"><%= i.toString() %></a>				
				<%		}
					}
				%>
				<% if (pageEnd<pageCount){ %>... <a href="<%= purl+pageCount.toString() %>">最后一页</a><%} %>
				
			</div>
			<% } %>
			<!-- page -->
		</div>
		<script type="text/javascript">
			limitCharacterLength(".gameitem_right>big",40);
			limitCharacterLength(".gameitem_right>p",200);
		</script>
		<!-- left -->
		
		<!-- 右侧栏 -->
      	<div class="rightdiv">
      		<!-- 搜索框  -->
      		<ul class="searchborder">
				<li class="inlineli">
					<input id="searchtext" type="text" class="searchinput" value="搜索游戏,资讯,攻略" onfocus="if(this.value==nullsearch){this.value='';this.style.color='#000000';}" onblur="if(this.value==''){this.value=nullsearch;this.style.color='#888888';}" />
				</li>
				<li class="inlineli">
			        <a href="javascript:doSearch();" title="搜索" ></a>
				</li>
				<% java.util.Map count = (java.util.Map)request.getAttribute("count"); %>
				<span>共<%= count.get("games") %>个游戏，<%= count.get("articles") %>篇资讯文章</span>
			</ul>
			<!-- search -->
		
		
			<!-- 分类 TOP 10 -->
			<div class="toplist rightbox_center">
				<h1>分类游戏 TOP 10</h1>
				<% List<java.util.Map> gameTop10 = (List<java.util.Map>)request.getAttribute("gameTop10"); %>
				<% for (int i=0;i<gameTop10.size();i++){ %>
					<a href="/gamedetail.do?id=<%= gameTop10.get(i).get("game_id") %>" title="<%= gameTop10.get(i).get("simplified_chinese_name") %>" target="_blank"><div class="toplist_icon" style="background-position:0px -<%= i*15 %>px;"></div><div class="toplist_text"><%= gameTop10.get(i).get("simplified_chinese_name") %></div></a>
				<% } %>
			</div>
			<div class="rightbox_bottom"></div>
			<script type="text/javascript">
				limitCharacterLength(".toplist>a div",24);
			</script>
		</div>
		<!-- right -->	
		
		
		</div>
		<!-- 内容 -->
	</div>
	<!-- 外框阴影 -->
	
	<div class="footer_shadow"></div>	
	
	<%@ include file="footer.jsp" %>
	
</div>
<!-- 主页面 -->
</div>
<!-- 外层 -->

</body>
</html>